home *** CD-ROM | disk | FTP | other *** search
/ The Games Machine 76 / XENIATGM66.iso / Indiana Jones / Indiana Jones.exe / RESOURCE / PREVIEW.GOB / cog_olv_doorswitch_underwater.cog < prev    next >
Text File  |  1999-11-15  |  4KB  |  176 lines

  1. # Jones 3D Cog Script
  2. #
  3. # General Underwater Door.
  4. #
  5. # [DS]
  6. #
  7. # (C) 1999 LucasArts Entertainment Company LLC. All Rights Reserved
  8. #===============================================================================
  9.  
  10.  
  11. symbols
  12.  
  13.     message     startup
  14.     message     activated
  15.     message        arrived
  16.     message        timer
  17.  
  18.     thing       switch0         
  19.     thing        door0
  20.     thing        indy                nolink    desc=cutscene actor
  21.     thing        campos
  22.     thing        campos2
  23.     thing        cam2_targ    
  24.     flex        movespeed=0.5
  25.     
  26.     thing        player                    local
  27.     sector      doorsector                    local
  28.     int        doorstatus                    local
  29.     int        movestatus                    local
  30.     keyframe    in_activate=in_uw_pullswitch.key    local 
  31.     keyframe    in_door=in_activate_medium.key    local
  32.  
  33. # ---------------------------------------------------------------
  34. #        Indy Say Lines
  35. # ---------------------------------------------------------------
  36.     int    lineindex                    local # indexes sound array
  37.  
  38.     sound    in_stuck0=Inxj096.wav        local # I can't open it
  39.     sound    in_stuck1=Inxj097.wav        local # For some reason...won't open.
  40.     sound    in_stuck2=Inxj098.wav        local # It won't budge.
  41.     sound    in_stuck3=Inxj099.wav        local # Something is holding this door closed.
  42.     sound    in_stuck4=Inxj102.wav        local # must be way...don't know how.
  43.     sound    in_stuck5=Inxj090.wav        local # ...something wrong.
  44.     sound    in_stuck6=Inxj091.wav        local # Of course that didn't work.    
  45.     int    dl_newline=50            local
  46.     int    dl_oldline=50            local
  47.  
  48.  
  49.     flex        randlocklines        local
  50.     int        speak0            local
  51.     flex        checkstatus            local
  52.     int        curcam            local
  53.     flex        open_doors            local
  54.     int        lockoffset=0        local
  55.  
  56. end
  57.  
  58. code
  59.  
  60. #========================================================================================
  61. startup:
  62.     player = GetLocalPlayerThing();
  63.     doorsector = GetThingSector(door0);
  64.     SetSectorAdjoins(doorsector, 0);
  65.     return;
  66.     
  67. activated:
  68.     if(GetSenderRef() == door0)
  69.     {
  70.         SetActorFlags(player, 0x200000);
  71.         StopThing(Player);
  72.         DeselectWeaponWait(player);
  73.         PlayKey(player, in_door, 4, 0x12, 0);
  74.         call randlocklines;
  75.         WaitForSound(speak0);
  76.         ClearActorFlags(player, 0x200000);
  77.         return;
  78.     }
  79.     if (GetSenderRef() == switch0)
  80.     {
  81.         call checkstatus;
  82.         if(movestatus) return;
  83.         curCam = GetCurrentCamera();
  84.         if(doorstatus == 0)
  85.         {                                      
  86.         SetSectorAdjoins(doorsector, 1);
  87.         SetThingFlags(player, 0x80000);
  88.         SetActorFlags(player, 0x200000);
  89.         CopyPlayerHolsters(player, indy);
  90.         StartCutscene(1);
  91.         ClearThingFlags(indy, 0x80000);
  92.         SetCameraLookInterp(2, 0);            # turns off interp to lookthing.
  93.         SetCameraFocus(2, campos);
  94.         SetCameraSecondaryFocus(2, indy);
  95.         SetCurrentCamera(2);
  96.         SetCameraFOV(90, 0, 0);                # makes sure set to default.    
  97.         SetTimer(1.5);
  98.         PlayKey(indy, in_activate, 4, 0x12, 1);
  99.  
  100.         SetCameraPosInterp(2, 1);
  101.         SetCameraInterpSpeed(2, 1.5);
  102.         SetCameraFocus(2, campos2);
  103.         SetCameraSecondaryFocus(2, cam2_targ);
  104.         SetCurrentCamera(2);
  105.         call open_doors;
  106.         WaitForStop(door0);
  107.         SetCameraInterpSpeed(2, 1.0);            #Reset Default.
  108.         SetCameraPosInterp(2, 0);
  109.  
  110.         SetCurrentCamera(curCam);
  111.         SetThingFlags(indy, 0x80000);
  112.         ClearActorFlags(player, 0x200000);
  113.         ClearThingFlags(player, 0x80000);
  114.         EndCutscene();
  115.         }
  116.     }
  117.     return;
  118.     
  119. #====================================================================
  120. arrived:
  121.     if (getsenderref() != door0) return;
  122.     return;
  123.  
  124. timer:
  125.     MoveToFrame(switch0, 1, 0.5);
  126.     return;
  127.  
  128. open_doors:
  129.     movetoframe(door0, 1, movespeed);
  130.     return;
  131.  
  132.  
  133. #=====================================================================
  134. checkstatus:
  135.     moveStatus = 0;
  136.     doorStatus = 0;
  137.     if (door0 >= 0) {
  138.             moveStatus = moveStatus + IsThingMoving(door0);
  139.             doorStatus = doorStatus + GetCurFrame(door0);
  140.         }
  141.     return;
  142.  
  143. #=====================================================================
  144. #        Locked lines
  145. #=====================================================================
  146. randlocklines:
  147.  
  148.     while (dl_newline == dl_oldline)
  149.     {        
  150.         dl_newline = RandBetween(0, 19);
  151.         if (dl_newline < 14)
  152.         {    
  153.             dl_newline = RandBetween(0, 2); # ~1/4 chance for 0 thru 2
  154.         }
  155.  
  156.         if (dl_newline > 17)
  157.         {
  158.             dl_newline = (dl_newline - 13); # 1/20 chance for 5 or 6 
  159.         }    
  160.         if (dl_newline > 15)
  161.         {
  162.             dl_newline = 4; # 1/10 chance
  163.         }
  164.         if (dl_newline > 13)
  165.         {
  166.             dl_newline = 3; # 1/10 chance
  167.         }
  168.     }
  169.     dl_oldline = dl_newline;
  170.     lineindex = lockoffset + dl_newline;
  171.     speak0 = PlayVoice(player, in_stuck0[lineindex], 1.0, 0);
  172.     return;
  173.  
  174.     
  175. end
  176.